<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      template="/layout/administration.xhtml">

<ui:define name="head">

	  </ui:define>
    
    <ui:define name="title">
			<h3>Projects</h3>
	</ui:define>

	<ui:define name="list">
        <h:outputText value="No project exists" rendered="#{empty projectList.resultList}"/>

        <h:dataTable id="userList" var="project" value="#{projectList.resultList}" rendered="#{not empty projectList.resultList}">
            <h:column>
                <f:facet name="header">Id</f:facet>
                #{project.id}
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <s:link id="user" value="#{project.name}" propagation="none" view="/admin/projects.xhtml">
                    <f:param name="projectId" value="#{project.id}"/>
                </s:link>
            </h:column>
    	</h:dataTable>
    </ui:define>
    <ui:define name="settings">
        <h:form id="projectForm">
	       	<h4>Add, modify or delete a project:</h4>
	       	<h:outputText value="Name: "/><br/>
	       	<h:inputText value="#{projectHome.instance.name}" /><br/>
	       	<h:outputText value="Description: "/><br/>
	       	<h:inputTextarea rows="20" cols="40" value="#{projectHome.instance.description}" /><br/>
	       	<div class="commandButtons">
		        <h:commandButton id="save"
		                      value="Create"
		                     action="#{projectHome.persist}"
		                   rendered="#{!projectHome.managed}"/>
		        <h:commandButton id="update"
		                      value="Save"
		                     action="#{projectHome.update}"
		                   rendered="#{projectHome.managed}"/>
		        <h:commandButton id="delete"
		                      value="Delete"
		                     action="#{projectHome.remove}"
		                  immediate="true"
		                   rendered="#{projectHome.managed}"/>
		        <s:button propagation="end"
		                           id="cancel"
		                        value="Cancel"
		                         view="/admin/projects.xhtml"/>
	        </div>
		</h:form>
	</ui:define>
</ui:composition>